import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const store = new Vuex.Store({
	state: {
		keepAliveViews: [],
		permissions: []
	},
	mutations: {
		// 保存缓存页面
		SET_KEEP_ALIVE: (state, value) => {
			state.keepAliveViews = value;
		},
		SET_PERMISSIONS: (state, value) => {
			state.permissions = value;
		}
	},
	getters: {
		keepAliveViews: state => state.keepAliveViews,
		permissions: state => state.permissions
	},
	actions: {
		getPermissions: async ({
			state,
			commit
		}) => {
			/* if (state.permissions.length) return;
			const list = await api.getPermissions();
			commit('SET_PERMISSIONS', list); */
		}
	}
});
export default store;
